package com.gues.ddc_app.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gues.ddc_app.entity.Menu;
import com.gues.ddc_app.entity.Orders;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.io.Serializable;
import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author huHang
 * @since 2023-02-12
 */
public interface OrdersMapper extends BaseMapper<Orders> {
    @Select("SELECT o.*,shop_img as 'shop.shopImg',shop_name AS 'shop.shopName',user_name AS 'user.userName' FROM shop s,USER u,orders o WHERE u.user_id = o.user_id AND s.shop_id = o.shop_id")
    <E extends IPage<Orders>> E queryByCondition(E page);
    @Select("SELECT o.*,shop_img as 'shop.shopImg',shop_name AS 'shop.shopName',user_name AS 'user.userName',can_name as 'shop.canName' FROM shop s,USER u,orders o WHERE u.user_id = o.user_id AND s.shop_id = o.shop_id and ${ew.sqlSegment}")
    public List<Orders> getList(@Param("ew") Wrapper<Orders> wrapper);
}
